<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'contact.jsp' starting page</title>
    <link rel="stylesheet" href="css/screen.css" type="text/css" media="screen, projection">
	<!--[if IE]>
	  <link rel="stylesheet" href="css/ie.css" type="text/css" media="screen, projection">
	<![endif]-->
	<link rel="stylesheet" href="css/style.css" type="text/css" media="screen, projection">
	<link href="../css/application-766336123a9b61bedf26182718c02860.css" media="all" rel="stylesheet" type="text/css">
	<script type="text/javascript" async="" src="../js/ga.js"></script><script src="../js/application-e8369d8531953caeeedd0118548cdc1c.js" type="text/javascript"></script>
	<meta content="authenticity_token" name="csrf-param">
<meta content="4NAq56gfzq9IhDJLLR4pUWgQs7xLI5nFWq6+6mYHmUA=" name="csrf-token">
	
	
	<script type="text/javascript" charset="utf-8">
		$(document).ready(function() {
			$('#search').marcoPolo({
			  url: '/search',
			  formatItem: function (data, $item) {
			    return data.icon + data.name;
			  },
			  onSelect: function (data, $item) {
					if (data.url != '#') {
						$('#search').val(data.name);
				    window.location = data.url;
					}
			  }
			});
			
			validate_form('#task_form', true)
			
			$('a.zoom').fancyZoom({scaleImg: true, closeOnClick: true})
			
			$('#search-link').data('tooltip').options.placement = 'bottom';
		});
		
		$(document).scroll(function(){
	    if ($('.back-top').attr('data-top') <= $(this).scrollTop())
        $('.back-top').removeClass('hide');
	    else
        $('.back-top').addClass('hide');
		});
		
	</script>
  </head>
  
  <body>
  	<body class="crm">
	<div class="navbar navbar-fixed-top">
  	<div class="navbar-inner">
	  	<div class="container-fluid">
				<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</a>
				<a class="brand" href="home.action"><img alt="Workxp-logo" src="../img/workxp-logo-68b281b82e899ff436ecf42ebcc1bc58.png"></a>
				<div class="nav-collapse">
		  		<ul class="nav">
						<li class="divider-vertical"></li>
						<li class=""><a href="../main.action">最新动态</a></li>
						<li class="active"><a href="list.action">联系人</a></li>
						<li class=""><a href="../task/task.action">任务</a></li>
						
						<li class=""><a href="../deal/list.action">机会</a></li>
			    </ul>
					
					<ul class="nav">
					  <li class="dropdown">
							<a href="https://1344267101.workxp.info/tasks#" class="dropdown-toggle" data-toggle="dropdown">
						    添加
						    <span class="caret"></span>
						  </a>
						  <ul class="dropdown-menu new-actions">
						    <li><a href="addcontact.action"><i class="icon-person"></i> 联系人</a></li>
								<li><a href="addcompany.action"><i class="icon-company"></i> 公司</a></li>
								<li class="divider"></li>
								<li><a href="https://1344267101.workxp.info/tasks#taskModal"><i class="icon-ok"></i> 任务</a></li>
								
								<li><a href="../deal/adddeal.action"><i class="icon-dollar"></i> 机会</a></li>
						  </ul>
						</li>
					</ul>
					<ul class="nav">
						<li class="divider-vertical"></li>
					</ul>
					<form class="navbar-search">
						<input type="text" name="search" id="search" class="search-query mp_input" placeholder="搜索联系人或机会" autocomplete="off" x-webkit-speech="" style="height:30px;"><ul class="typeahead dropdown-menu mp_list" style="display: none; "></ul>
			    </form>
					
					<ul class="nav">
						<li><a href="https://1344267101.workxp.info/notes/search" rel="tooltip" id="search-link" data-original-title="搜索事件"><i class="icon-cog"></i></a></li>
					</ul>
			
					<ul class="nav pull-right">
						<li class=""><a href="https://1344267101.workxp.info/profiles">${sessionScope.user.username }</a></li>
						
								<li class="dropdown">
									<a data-toggle="dropdown" class="dropdown-toggle" href="https://1344267101.workxp.info/tasks#">管理 <b class="caret"></b></a>
									<ul class="dropdown-menu settings">
										<li><a href="https://1344267101.workxp.info/product_users"><i class="icon-user"></i> 同事</a></li>
										<li><a href="https://1344267101.workxp.info/groups"><i class="icon-group"></i> 组</a></li>
										<li class="divider"></li>
										<li><a href="https://1344267101.workxp.info/settings"><i class="icon-cog"></i> 帐号</a></li>
									</ul>
								</li>
						
						<li class="divider-vertical"></li>
						<li class=""><a href="../logout.action">退出</a></li>
			    </ul>
				</div>
		  </div>
	  </div>
  </div>

	
	<div class="container">
		
			<div class="row">
				  <div class="span2"></div>
				  <div class="span8" >
					
						<div class="page-header well" style="background-color:#F0F5F8;margin-top:10px;">
						  <h2><img src="../img/contact_list.png" alt="" />&nbsp;通讯录</h2>
						</div>	
						<div class="page-header well" style="background-color:#FFFFFF;">
							<table class="table">
							  <tbody>
							  		<tr >
							  			<td>联系对象</td>
							  			<td>创建时间</td>
							  			<td>负责人</td>
							  		</tr>
							  	
							  		
							  		<c:forEach items="${contactList }" var="contact">
									<c:if test="${contact.view == 'all' }">
								
									<tr>
									  <td>
										<c:choose>
												<c:when test="${contact.name == null}"><img src="../img/company.png" alt="" /><a href="showcontact.action?id=${contact.id}">&nbsp;&nbsp;${contact.companyname }</c:when>
												<c:when test="${contact.name != null }"><img src="../img/contact.png" alt="" /><a href="showcontact.action?id=${contact.id}">&nbsp;&nbsp;${contact.name }</c:when>
										</c:choose>
									</td>
									<td>
										${contact.createtime }
									</td>
									<td><a href="">${contact.user.username }</a></td>
									</tr>
									
								</c:if>

								<c:if test="${contact.view == 'me' }">
									<c:if test="${contact.user.id == user.id }">
										<tr>
										  <td>
											<c:choose>
													<c:when test="${contact.name == null}"><img src="../img/company.png" alt="" /><a href="showcontact.action?id=${contact.id}">&nbsp;&nbsp;${contact.companyname }</c:when>
													<c:when test="${contact.name != null }"><img src="../img/user.png" alt="" /><a href="showcontact.action?id=${contact.id}">&nbsp;&nbsp;${contact.name }</c:when>
											</c:choose>
										</td>
										<td>
											${contact.createtime }
										</td>
										<td><a href="">${contact.user.username }</a></td>
										</tr>
									</c:if>
								</c:if>
								
								<c:if test="${contact.view  != 'all' and contact.view != 'me'}">
									<c:if test="${contact.user.id == user.id }">
									<tr>
									  <td>
										<c:choose>
												<c:when test="${contact.name == null}"><img src="../img/company.png" alt="" /><a href="showcontact.action?id=${contact.id}">&nbsp;&nbsp;${contact.companyname }</c:when>
												<c:when test="${contact.name != null }"><img src="../img/user.png" alt="" /><a href="showcontact.action?id=${contact.id}">&nbsp;&nbsp;${contact.name }</c:when>
										</c:choose>
									</td>
									<td>
										${contact.createtime }
									</td>
									<td><a href="">${contact.user.username }</a></td>
									</tr>
									</c:if>
								</c:if>
								
								<c:if test="${contact.view  != 'all' and contact.view != 'me'}">
									<c:if test="${contact.view == userGroup.groupname  and contact.user.id != user.id}">
									<tr>
									  <td>
										<c:choose>
												<c:when test="${contact.name == null}"><img src="../img/company.png" alt="" /><a href="showcontact.action?id=${contact.id}">&nbsp;&nbsp;${contact.companyname }</c:when>
												<c:when test="${contact.name != null }"><img src="../img/user.png" alt="" /><a href="showcontact.action?id=${contact.id}">&nbsp;&nbsp;${contact.name }</c:when>
										</c:choose>
									</td>
									<td>
										${contact.createtime }
									</td>
									<td><a href="">${contact.user.username }</a></td>
									</tr>
									</c:if>
								</c:if>
									
								
								</c:forEach>
									
									
								
							  </tbody>
							</table>
						</div>	
						
				  </div>
				  <div class="span4">
				  		
						  
						<div class="page-header well">
							<table class="table">
								<h3>通讯录管理</h3>
							  <tbody>
								<tr>
								  <td><img src="../img/contact.png" alt="" /><a href="addcontact.action">添加联系人</a></td>
								</tr>
								<tr>
								  <td><img src="../img/company.png" alt="" /><a href="addcompany.action">添加公司</a></td>
								</tr>
								<tr>
								  <td><img src="../img/contact.png" alt="" /><a href="show_editcontact.action">修改联系人</a></td>
								</tr>
								<tr>
								  <td><img src="../img/contact.png" alt="" /><a href="show_delcontact.action">删除联系人</a></td>
								</tr>
								<tr>
								  <td><img src="../img/export_to_document.png" alt="" />
											<a  data-toggle="modal" href="#myModal" >点击导入联系人</a>
	
												<div class="modal fade" id="myModal">
												  <div class="modal-header">
													<a class="close" data-dismiss="modal"><img src="../img/closebox.png"></a>
													<h3>您的联系人文件放入C盘import文件夹中了吗？</h3>
												  </div>
													 <form novalidate="novalidate" method="post" id="user-form" class="simple_form well" action="import_contact.action" accept-charset="UTF-8"><div style="margin:0;padding:0;display:inline"><input type="hidden" value="✓" name="utf8"><input type="hidden" value="y27zJQeqxEC1a5ndwzOvNh+/zsUoKoR8yeyGZRDmpus=" name="authenticity_token"></div>
												  <div class="modal-body">
													 
														  <div class="control-group email required"><div class="controls"><input type="text" value="" size="50" placeholder="要导入的联系人文件名" name="import_name" id="user_email" class="string email required span3"></div></div>
												  </div>
												  <div class="modal-footer">
													<input name="" class="btn btn-primary" type="submit" value="导入"/>
													<a href="#" class="btn"   data-dismiss="modal">取消</a>
												  </div>
														</form>
												</div>
	
								  </td>
								</tr>
								<tr>
								  <td><img src="../img/export.png" alt="" />
								  			
								  			<a  data-toggle="modal" href="#exportModal" >点击导出联系人</a>
	
												<div class="modal fade" id="exportModal">
												  <div class="modal-header">
													<a class="close" data-dismiss="modal"><img src="../img/closebox.png"></a>
													<h3>导出的联系人文件默认存在C盘export文件夹中！</h3>
												  </div>
													 <form novalidate="novalidate" method="post" id="user-form" class="simple_form well" action="export_contact.action" accept-charset="UTF-8"><div style="margin:0;padding:0;display:inline"><input type="hidden" value="✓" name="utf8"><input type="hidden" value="y27zJQeqxEC1a5ndwzOvNh+/zsUoKoR8yeyGZRDmpus=" name="authenticity_token"></div>
												  <div class="modal-body">
													 
														  <div class="control-group email required"><div class="controls"><input type="text" value="" size="50" placeholder="请给导出的联系人文件命名" name="export_name" id="user_email" class="string email required span4" style="height:30px;"></div></div>
												  </div>
												  <div class="modal-footer">
													<input name="" class="btn btn-primary" type="submit" value="导出"/>
													<a href="#" class="btn"   data-dismiss="modal">取消</a>
												  </div>
												</form>
												</div>
								  
								  </td>
								</tr>
							  </tbody>
							</table>
						</div>	
						
									
						
						
					  </div>
					</div>
			</div>
			
			
	
		</div>
		
	<script type="text/javascript">
		$(document).ready(function(){
			$("#new_task").click(function(){
				$('#myModal').modal({
					backdrop:true,
					keyboard:true,
					show:false
				});
			});
			
			$('#myModal').modal({
				backdrop:true,
				keyboard:true,
				show:false
			});
			
		});
		
	</script>
 
  </body>
</html>
